package com.lmt.block;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.lmt.entity.User;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @Description: TODO
 * @Author: Amazing
 * @Date: 2022/8/1 19:07
 * @Version: 1.0
 */
public final class BlockHandlerDemo {

    // 限流与阻塞处理 : 参数要和 被降级的方法参数一样
    public static User exceptionHandler(Long id, BlockException ex) {
        return User.builder().id(-1L).name("限流了").intro("请稍后重试").build();
    }

}
